home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
e
/
stringnd.lha
/
stringnode_examples
/
StringNode_Example2.e
< prev
next >
Wrap
Text File
|
1995-11-07
|
1KB
|
56 lines
/*
** StringNode Example-2
**
** add(), del(), first(), succ() AND last() methods.
**
** (C)Copyright 1995 Fabio Rotondo
**
** e-mail: fosft@intercom.it
*/
MODULE 'fabio/StringNode_oo' -> Our MAGIC MODULE
PROC main()
DEF n:PTR TO stringnode -> This is our OBJECT instance
NEW n.stringnode() -> OBJECT initialization
n.add('Zorro') -> Here we add some items...
n.add('Batman')
n.add('Superman')
n.add('Gold Drake')
n.add('Mandrake')
n.add('MOMMY')
shwall(n) -> Here we see them
n.first() -> This method should be checked agains FALSE...
n.del() -> It is DEAD!
shwall(n) -> Show Results
n.succ() -> Two items later... (The first killed...)
n.del() -> Another Kill!
shwall(n) -> Show Results
n.last() -> The last item
n.del() -> Is DEAD too!
WriteF('Last:\s\n', n.name()) -> Now this is the last
shwall(n)
END n -> Remember ALWAYS TO end an OBJECT
ENDPROC
PROC shwall(n:PTR TO stringnode)
WriteF('------- \d ----------\n', n.numitems())
IF n.first() -> Here we go TO the first node item
REPEAT
WriteF('Node:\s\n', n.name()) -> Node STRING...
UNTIL n.succ() = FALSE -> LOOP UNTIL the end
ELSE
WriteF('No Nodes in LIST...\n')
ENDIF
ENDPROC